﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using MREO.data;
using System.Data.SqlServerCe;
using System.Data;
using System.Diagnostics;

namespace MREO.gui
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Вход в систему
            fLogOn fenter = new fLogOn();
            if (fenter.ShowDialog() != DialogResult.OK) return;

            GValues._userID = fenter.oUser._id;
            GValues._userFIO = fenter.oUser._fam + " " + fenter.oUser._im + " " + fenter.oUser._otch;

            DataTable mnuDt = null;
            // Заполняем меню
            try
            {
                supportMethod supMethod = new data.supportMethod();
                mnuDt = supMethod.loadMnu();
                if (mnuDt == null) throw new Exception("Нет элементов для построеня меню.\n mnuDt == null.");
            }
            catch (Exception exc)
            {
                Debug.Print(exc.Message);
                MessageBox.Show(exc.Message);
                return;
            }

            Application.Run(new fMain(mnuDt));
        }
    }
}
